package no.weather.misc;

import java.io.IOException;
import java.io.InputStream;

import org.xml.sax.InputSource;

public class InputSourceWithProgressListener extends InputSource {
	private final InputStreamWithProgressListener stream;

	public InputSourceWithProgressListener(InputStream stream) {
		super(stream);
		this.stream = new InputStreamWithProgressListener(stream);
	}

	@Override
	public InputStream getByteStream() {
		return stream;
	}

	private class InputStreamWithProgressListener extends InputStream {
		private final InputStream stream;

		public InputStreamWithProgressListener(InputStream stream) {
			super();
			this.stream = stream;
		}

		@Override
		public int read() throws IOException {
			return stream.read();
		}

	}
}
